package com.example.sup.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.example.sup.utils.StringUtil;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 
 * @TableName task_management
 */
@TableName(value ="task_management")
@Data
public class TaskManagement implements Serializable {
    /**
     * 任务管理
     */
    @TableId(type = IdType.AUTO)
    @NotNull
    private Integer taskId;

    /**
     * 监室id
     */
    @NotBlank
    @NotNull
    private String prisonId;

    /**
     * 监室名称
     */
    @NotBlank
    @NotNull
    private String prisonName;

    /**
     * 任务执行时间
     */
    @NotBlank
    @NotNull
    private String taskTime;

    /**
     * 任务名称
     */
    @NotBlank
    @NotNull
    private String taskName;

    /**
     * 监区名称
     */
    @NotBlank
    @NotNull
    private String prisonDistrictName;

    /**
     * 开关状态 1开 0关
     */
    private Integer state;

    /**
     * 预案设置id
     */
    private Integer planSettingId;

    /**
     * 预案设置名称
     */
    @NotBlank
    @NotNull
    private String planSettingName;

    /**
     * 描述
     */
    private String represent;

    /**
     * cron表达式
     */
    private String cron;

    /**
     * 星期
     */
    private String weekRange;

    /**
     * 空调类型
     */
    private Integer acType;

    /**
     * 空调模式
     */
    private Integer acPattern;

    /**
     * 空调温度
     */
    private Integer acTemperature;

    /**
     * 任务类型(1设备定时/2空调定时)
     */
    private String reservedFields2;

    /**
     * 
     */
    private Integer userInfoId;

    /**
     * 
     */
    private Date createTime;

    /**
     * 
     */
    private String createBy;

    /**
     * 
     */
    private LocalDateTime updateTime;

    /**
     * 
     */
    private String updateBy;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 日期
     */
    @TableField(exist = false)
    private List<String> weekData = new ArrayList<String>();
    /**
     * 监室id
     */
    @TableField(exist = false)
    private List<String> prisonIdData = new ArrayList<String>();

    public List<String> getPrisonIdData() {
        if (!StringUtil.isEmpty(getPrisonId())) {
            String[] priStr = getPrisonId().split(",");
            for (String str : priStr) {
                prisonIdData.add(str);
            }
        }
        return prisonIdData;
    }

    public List<String> getWeekData() {
        if (!StringUtil.isEmpty(getWeekRange())) {
            String[] weekStr = getWeekRange().split(",");
            for (String str : weekStr) {
                weekData.add(str);
            }
        }
        return weekData;
    }


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TaskManagement other = (TaskManagement) that;
        return (this.getTaskId() == null ? other.getTaskId() == null : this.getTaskId().equals(other.getTaskId()))
            && (this.getPrisonId() == null ? other.getPrisonId() == null : this.getPrisonId().equals(other.getPrisonId()))
            && (this.getPrisonName() == null ? other.getPrisonName() == null : this.getPrisonName().equals(other.getPrisonName()))
            && (this.getTaskTime() == null ? other.getTaskTime() == null : this.getTaskTime().equals(other.getTaskTime()))
            && (this.getTaskName() == null ? other.getTaskName() == null : this.getTaskName().equals(other.getTaskName()))
            && (this.getPrisonDistrictName() == null ? other.getPrisonDistrictName() == null : this.getPrisonDistrictName().equals(other.getPrisonDistrictName()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getPlanSettingId() == null ? other.getPlanSettingId() == null : this.getPlanSettingId().equals(other.getPlanSettingId()))
            && (this.getPlanSettingName() == null ? other.getPlanSettingName() == null : this.getPlanSettingName().equals(other.getPlanSettingName()))
            && (this.getRepresent() == null ? other.getRepresent() == null : this.getRepresent().equals(other.getRepresent()))
            && (this.getCron() == null ? other.getCron() == null : this.getCron().equals(other.getCron()))
            && (this.getWeekRange() == null ? other.getWeekRange() == null : this.getWeekRange().equals(other.getWeekRange()))
            && (this.getAcType() == null ? other.getAcType() == null : this.getAcType().equals(other.getAcType()))
            && (this.getAcPattern() == null ? other.getAcPattern() == null : this.getAcPattern().equals(other.getAcPattern()))
            && (this.getAcTemperature() == null ? other.getAcTemperature() == null : this.getAcTemperature().equals(other.getAcTemperature()))
            && (this.getReservedFields2() == null ? other.getReservedFields2() == null : this.getReservedFields2().equals(other.getReservedFields2()))
            && (this.getUserInfoId() == null ? other.getUserInfoId() == null : this.getUserInfoId().equals(other.getUserInfoId()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        result = prime * result + ((getPrisonId() == null) ? 0 : getPrisonId().hashCode());
        result = prime * result + ((getPrisonName() == null) ? 0 : getPrisonName().hashCode());
        result = prime * result + ((getTaskTime() == null) ? 0 : getTaskTime().hashCode());
        result = prime * result + ((getTaskName() == null) ? 0 : getTaskName().hashCode());
        result = prime * result + ((getPrisonDistrictName() == null) ? 0 : getPrisonDistrictName().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getPlanSettingId() == null) ? 0 : getPlanSettingId().hashCode());
        result = prime * result + ((getPlanSettingName() == null) ? 0 : getPlanSettingName().hashCode());
        result = prime * result + ((getRepresent() == null) ? 0 : getRepresent().hashCode());
        result = prime * result + ((getCron() == null) ? 0 : getCron().hashCode());
        result = prime * result + ((getWeekRange() == null) ? 0 : getWeekRange().hashCode());
        result = prime * result + ((getAcType() == null) ? 0 : getAcType().hashCode());
        result = prime * result + ((getAcPattern() == null) ? 0 : getAcPattern().hashCode());
        result = prime * result + ((getAcTemperature() == null) ? 0 : getAcTemperature().hashCode());
        result = prime * result + ((getReservedFields2() == null) ? 0 : getReservedFields2().hashCode());
        result = prime * result + ((getUserInfoId() == null) ? 0 : getUserInfoId().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", taskId=").append(taskId);
        sb.append(", prisonId=").append(prisonId);
        sb.append(", prisonName=").append(prisonName);
        sb.append(", taskTime=").append(taskTime);
        sb.append(", taskName=").append(taskName);
        sb.append(", prisonDistrictName=").append(prisonDistrictName);
        sb.append(", state=").append(state);
        sb.append(", planSettingId=").append(planSettingId);
        sb.append(", planSettingName=").append(planSettingName);
        sb.append(", represent=").append(represent);
        sb.append(", cron=").append(cron);
        sb.append(", weekRange=").append(weekRange);
        sb.append(", acType=").append(acType);
        sb.append(", acPattern=").append(acPattern);
        sb.append(", acTemperature=").append(acTemperature);
        sb.append(", reservedFields2=").append(reservedFields2);
        sb.append(", userInfoId=").append(userInfoId);
        sb.append(", createTime=").append(createTime);
        sb.append(", createBy=").append(createBy);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}